<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<jsp:include page="inc.jsp"></jsp:include>
<link rel="stylesheet" href="${ctx}/css/main.css" />
<title>伊翔分销平台系统</title> 
<script>
	//获取公告信息
	$(function(){
		$.ajax({
			type:"get",
			url:'${ctx}/notice/noticePage?page=1&rows=10&temp='+Math.random(),
			dataType:'json',
			async:true,
			success:function(data) {
				var arr = data.rows;
				if (arr.length > 0) {
					for (var i = 0; i < arr.length; i++) {
						$("span[class='left'] > a").eq(i).text(CommonConverter.toNullString(arr[i].title)).attr("href","${ctx}/notice/view/"+arr[i].id);
						$("span[class='right']").eq(i).text(CommonConverter.toNullString(arr[i].createTime));
					}
				}
			}
		});
		 
		//散客查询
		$("#query").click(function(){
			var deptCityName = "";
			var arrCityName = "";
			var deptCity="";//出发城市
			var arrCity="";//到达城市
			var deptDate="";//出发日期
			var seatClass="";//舱位
			var charterType="";//类型
			var routingType="";
			charterType="SK";
			deptCityName=$("#homecity_name").val();
			arrCityName=$("#getcity_name").val();
			deptCity=$("#startCity").val();
			arrCity=$("#arrCity").val();
			deptStartDate=$("#startDate").val();
			seatClass=$("#seat").val();
			routingType=$('input[name="routingType"]:checked').val();
			var url = '${ctx}/np/query?deptCity='+deptCity+'&arrCity='+arrCity+'&deptStartDate='+deptStartDate+'&seatClass='+seatClass+'&charterType='+charterType+'&routingType='+routingType+'&deptCityName='+deptCityName+'&arrCityName='+arrCityName+'&temp='+Math.random();
			window.location.href=url ;
		});
		//切位查询
		$("#queryQw").click(function(){
			var deptCityName = "";
			var arrCityName = "";
			var deptCity="";//出发城市
			var arrCity="";//到达城市
			var deptDate="";//出发日期
			var seatClass="";//舱位
			var charterType="";//类型 1硬切
			var sortType="PRICE";//排序方式
			var routingType="RT";//往返类型
			var seatCount="";//座位数
			var deptStartDate = addDate(2);
			charterType="QW";
			deptCityName=$("#homecity_name1").val();
			arrCityName=$("#getcity_name1").val();
			deptCity=$("#startCity1").val();
			arrCity=$("#arrCity1").val();
			//deptDate=$("#startDate").val();
			seatCount=$("#seatCount").val();
			seatClass=$("#seat1").val();
			//deptCity=deptCity.replace('{$startCity}','');
			//arrCity=arrCity.replace('{$arrCity}','');
			$("#count").val(seatCount);

			if(arrCity == ""){
				jQuery.messager.alert('提示:','到达城市输入有误!');
				return false;
			}
			if(seatClass == ""){
				jQuery.messager.alert('提示:','舱位不能为空!');
				return false;
			}
			if(seatCount == ""){
				jQuery.messager.alert('提示:','座位数不能为空!');
				return false;
			}
			var url = '${ctx}/np/queryQw?deptCity='+deptCity+'&arrCity='+arrCity+'&deptStartDate='+deptStartDate+'&seatClass='+seatClass+'&charterType='+charterType+'&sortType='+sortType+'&seatCount='+seatCount+'&routingType='+routingType+'&deptCityName='+deptCityName+'&arrCityName='+arrCityName+'&temp='+Math.random();
			window.location.href=url;
		});
	});
	function addDate(days) {
		var d = new Date();
		d.setDate(d.getDate() + days);
		var month = d.getMonth() + 1;
		var day = d.getDate();
		if (month < 10) {
			month = "0" + month;
		}
		if (day < 10) {
			day = "0" + day;
		}
		var val = d.getFullYear() + "-" + month + "-" + day;
		return val;
	}; 
</script>
</head>
<body>
<jsp:include page="head.jsp"></jsp:include>
<!-- 内容区 -->
<c:if test="${fn:contains(sessionInfo.resourceList, '/index/order')}">
	<div class="reserve">
		<div class="reserveBox">
			<ul class="reserveHeader">
				<li class="redText">航班查询<img src="${ctx}/image/planeSmall.gif"></li>
				<li class="hover active">散客预定</li>
				<li class="hover">切位预定</li>
			</ul>
			<ul class="list" id="reserveSK">
				<li style="line-height: 20px">
					<input type="radio" style="width:15px;" name="routingType" id="routeType1" value="RT" checked="checked"><label for="routeType1">往返程</label>
					<input type="radio" style="width:15px;" name="routingType" id="routeType2" value="OW"><label for="routeType2">单程</label>
				</li>
				<li >出发城市：
					<input type="text" value="" size="15" id="homecity_name" name="homecity_name" style="width:150px;height: 20px" mod="address|notice" mod_address_source="hotel" mod_address_suggest="" mod_address_reference="startCity" mod_notice_tip="中文/拼音" />
					<img class="city" src="${ctx}/image/city.gif">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
					<input id="startCity" name="startCity" type="hidden" value="" />
					到达城市：
					<input type="text" value="" size="15" id="getcity_name" name="getcity_name" style="width:150px;height: 20px" mod="address|notice" mod_address_source="hotel"  mod_address_reference="arrCity" mod_notice_tip="中文/拼音" />
					<img class="city" src="${ctx}/image/city.gif">
					<input id="arrCity" name="arrCity" type="hidden" value="" />
				</li>
				<li>

				</li>
				<li class="dateList">
					去程日期：
					<input type="text" id="startDate" class="Wdate"  value="${requestScope.deptDate}" onFocus="new WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'%y-%M-\#{%d+2}'})" style="width: 150px;height: 20px"/>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					舱位等级：
					<select data-options="panelHeight:'auto'" id="seat"style="height:24px;width:153px">
						<option value="">请选择</option>
						<option value="Y">经济舱</option>
						<option value="F">头等舱</option>
						<option value="C">商务舱</option>
					</select>
				</li>
				<li><a href="###"><span class="query" id="query">查询</span></a></li>
			</ul>
			<ul class="list" id="reserveQW" style="display:none;">
				<li>出发城市：
					<input type="text" value="" size="15" id="homecity_name1" name="homecity_name1" style="width:150px;height: 20px" mod="address|notice" mod_address_source="hotel" mod_address_suggest="" mod_address_reference="startCity1" mod_notice_tip="中文/拼音" />
					<img class="city" src="${ctx}/image/city.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input id="startCity1" name="startCity1" type="hidden" value="" />
					到达城市：
					<input type="text" value="" size="15" id="getcity_name1" name="getcity_name1" style="width:150px;height: 20px" mod="address|notice" mod_address_source="hotel"  mod_address_reference="arrCity1" mod_notice_tip="中文/拼音" />
					<img class="city" src="${ctx}/image/city.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input id="arrCity1" name="arrCity1" type="hidden" value="" />
				</li>
				<li>
					舱位等级：
					<select id="seat1" style="height:23px;width:153px;">
						<option value="">请选择</option>
						<option value="Y">经济舱</option>
						<option value="F">头等舱</option>
						<option value="C">商务舱</option>
					</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					座位数：
					<input type="text" id="seatCount"  style="width:150px;height: 20px"/>
				</li>
				<li>
					<input type="button" value="查询" class="query" id="queryQw"/>
				</li>
			</ul>
			<img class="planeBig" src="${ctx}/image/planeBig.gif">
		</div>
	</div>
</c:if>

<div class="newsBox">
	<div class="news">
		<ul class="newsHeader">
			<li>热点公告<img src="${ctx}/image/news.gif"></li>
			<li class="right"><a href="${ctx}/main/notice">查看更多</a></li>
		</ul>
		<ul class="newsContent">
			<li>
				<div class="left newsContent1"><span class="left"><a href=""></a></span><span class="right"></span></div>
				<div class="left newsContent1 newsContent2"><span class="left"><a href=""></a></span><span class="right"></span></div>
			</li>
			<li>
				<div class="left newsContent1"><span class="left"><a href=""></a></span><span class="right"></span></div>
				<div class="left newsContent1 newsContent2"><span class="left"><a href=""></a></span><span class="right"></span></div>
			</li>
			<li>
				<div class="left newsContent1"><span class="left"><a href=""></a></span><span class="right"></span></div>
				<div class="left newsContent1 newsContent2"><span class="left"><a href=""></a></span><span class="right"></span></div>
			</li>
			<li>
				<div class="left newsContent1"><span class="left"><a href=""></a></span><span class="right"></span></div>
				<div class="left newsContent1 newsContent2"><span class="left"><a href=""></a></span><span class="right"></span></div>
			</li>
			<li>
				<div class="left newsContent1"><span class="left"><a href=""></a></span><span class="right"></span></div>
				<div class="left newsContent1 newsContent2"><span class="left"><a href=""></a></span><span class="right"></span></div>
			</li>
		</ul>
	</div>
</div> 
<!-- 底部 -->
<script type="text/javascript" src="${ctx }/jslib/airport/fixdiv.js"></script>
<script type="text/javascript" src="${ctx }/jslib/airport/address.js"></script>
<!-- 底部 -->
<jsp:include page="footer.jsp"></jsp:include>
</body>
</html>